﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DataConcept.Entities;

namespace DataConcept.Business
{
    public class bl_ConceptInScene
    {
        da_ConceptEntities db = new da_ConceptEntities();

        public Guid Create(Guid conceptId, Guid sceneId, byte status)
        {
            Guid id = Guid.NewGuid();
            var result = (int)db.da_ConceptInScene_New(
                id,
                conceptId,
                sceneId,
                status).Single();

            if (result > 0)
                return id;
            else
                return Guid.Empty;
        }
        public int Detele(Guid conceptInSceneId)
        {
            var result = (int)db.da_ConceptInScene_Delete(
                conceptInSceneId).Single();

            return result;
        }

        public da_ConceptInScene GetById(Guid conceptInSceneId)
        {
            var result = db.da_ConceptInScene_GetbyId(
                conceptInSceneId).ToList();

            if (result.Count > 0)
                return result.First();
            else
                return null;
        }
        public da_ConceptInScene GetByForeignKey(Guid conceptId, Guid sceneId)
        {
            var result = db.da_ConceptInScene_GetbyForeignKey(
                conceptId,
                sceneId).ToList();

            if (result.Count > 0)
                return result.First();
            else
                return null;
        }
        public List<da_ConceptInScene> GetAll()
        {
            var result = db.da_ConceptInScene.ToList();

            return result;
        }
    }
}
